.\" Copyright (c) 2017, Martin Kepplinger <martink@posteo.de>
.\"
.\" %%%LICENSE_START(GPLv2+_DOC_FULL)
.\" This is free documentation; you can redistribute it and/or
.\" modify it under the terms of the GNU General Public License as
.\" published by the Free Software Foundation; either version 2 of
.\" the License, or (at your option) any later version.
.\"
.\" The GNU General Public License's references to "object code"
.\" and "executables" are to be interpreted as the output of any
.\" document formatting or typesetting system, including
.\" intermediate and printed output.
.\"
.\" This manual is distributed in the hope that it will be useful,
.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
.\" GNU General Public License for more details.
.\"
.\" You should have received a copy of the GNU General Public
.\" License along with this manual; if not, see
.\" <http://www.gnu.org/licenses/>.
.\" %%%LICENSE_END
.\"
.TH TS_SETUP 3  "" "" "tslib"
.SH NAME
ts_setup \- find, open and configure a touch screen input device
.SH SYNOPSIS
.nf
.B #include <tslib.h>
.sp
.BI "struct tsdev *ts_setup(const char *" dev_name ", int " nonblock ");"
.sp
.fi

.SH DESCRIPTION
.BR ts_setup ()
will try to find, open and configure the touch screen device.
On success it allocates memory for a new touch screen device, opens and links the input event device to it
and loads and initialises all modules configured in the tslib configuration file
.BR TSLIB_CONFFILE.

If \fBdev_name\fR is \fBNULL\fR
.BR ts_setup ()
will use the device defined by the \fBTSLIB_TSDEVICE\fR environment variable.

If \fBTSLIB_TSDEVICE\fR is not defined
.BR ts_setup ()
will try to use following devices:
.RS
/dev/input/ts,
.br
/dev/input/touchscreen,
.br
/dev/touchscreen/ucb1x00.
.RE
After that we ts_setup() scans /dev/input/event* for the first device with property INPUT_PROP_DIRECT.

.SH RETURN VALUE
A pointer to the opened
.BI "struct tsdev"
is returned.

.SH SEE ALSO
.BR ts_open (3),
.BR ts_close (3),
.BR ts_read (3),
.BR ts_config (3),
.BR ts.conf (5)
